<template>
    <div class="top">
            商品名称：
            <input type="text" v-model="name">
            商品价格：
            <input type="text" v-model="price">
        <button @click="addShop">添加商品</button>
    </div>
</template>
<script>
export default {
  data() {
    return {
      name: "",
      price: ""
    };
  },
  methods: {
    addShop() {
      this.$emit("addShop", { name: this.name, price: this.price });
      this.name=''
      this.price=''
    }
  }
};
</script>
<style lang="scss" scoped>
</style>


